/**
 * 装货扫描API
 * Created by 11057 on 2018/2/27.
 */
import {Injectable} from '@angular/core';
import {HttpParams} from '@angular/common/http';

import {HttpUtil} from '../HttpUtil';

@Injectable()
export class LoadingApi {

  constructor(public httpUtil: HttpUtil) {
  }

  /**
   * 扫描容器
   * @param qrcodeStr
   * @returns {Observable<any>}
   */
  scanConatiner(qrcodeStr: string) {
    const params = new HttpParams().set("token", localStorage.getItem("token")).set("qrcodeStr", qrcodeStr);
    return this.httpUtil.get("/api/loading/scanContainer", params);
  }

  /**
   * 扫描货物
   * @param param
   * @returns {Observable<any>}
   */
  scanMateriel(param: any) {

    const params = new HttpParams().set("token", localStorage.getItem("token")).set("qrcodeStr", param.qrcode).set("projectId", param.projectId).set("planId", param.planId).set("planPositionId", param.planPositionId).set("containerId", param.containerId);
    return this.httpUtil.get("/api/loading/scanMateriel", params);
  }

  /**
   * 选择容器
   */
  ChoseContainers(){
    const params = new HttpParams().set("token",localStorage.getItem("token"));
    return this.httpUtil.get("/api/loading/ChoseContainers",params);
  }

}
